/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.OneCommerceProject.beans;

import com.OneCommerceProject.entities.Fournisseur;
import com.OneCommerceProject.entities.Item;
import com.OneCommerceProject.entities.ItemFour;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Aymen
 */
@Stateless
public class ItemFourFacade extends AbstractFacade<ItemFour> {
    @PersistenceContext(unitName = "OneCommerceProjectPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ItemFourFacade() {
        super(ItemFour.class);
    }
    
    public ItemFour findItemLeader(BigDecimal iditem) {
        Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("iditem", iditem);		
        return super.findOneResult(ItemFour.FIND_ITEMLEADER, parameters);    
    }
    
    public ItemFour findItemFour(BigDecimal iditem, BigDecimal idfour) {
        Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("iditem", iditem);		
        parameters.put("idfour", idfour);
        return super.findOneResult(ItemFour.FIND_BY_ITEM_FOUR, parameters);    
    }
    
    public List<ItemFour> findByItem(BigDecimal iditem) {
        Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("iditem", iditem);		        
        return super.findMultipleResults(ItemFour.FIND_BY_ITEM, parameters);    
    }
}
